const express=require("express");
const cors = require("cors");
const bodyparser=require('body-parser');
const cookieParser=require("cookie-parser");
const app=express();
const userRouter=require('./routes/UserRouter.js');
const stuRouter=require('./routes/StuRouter.js');
const shopRouter=require('./routes/ShopRouter.js');
app.use(cors());
//导入bodyparser获取前端传过来的数据
app.use(bodyparser.json());
app.use(bodyparser.urlencoded({extended:false}));
app.use("/user",userRouter);
app.use("/stu",stuRouter);
app.use("/shop",shopRouter);
//使用cookieParser生成cookie
app.use(cookieParser());
app.listen(5000,'0.0.0.0',function(){
    console.log('服务器启动成功.....');
});